<!-- $Id: packageManager.xml.template 3819 2015-01-18 16:58:24Z pierre $ -->
<!-- Mandatory header for xml files  change encoding to the one
you use on your computer -->
<?xml version="1.0" encoding="UTF-8"?>
<!-- Mandatory DOCTYPE declaration. Fill free to add entities,
but no external entities in local files, since they would not
be accessible from JHALFSDIR. Change the document type `article' to
book if you prefer. That slightly changes the aspect if you render
it in html -->
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" >

<!-- The first markup should be the one defined in the DOCTYPE DECLARATION -->
<article>

<!-- First section for the tarball download address.
Only the next four lines are mandatory, but you can add anything
to make the text look more like the LFS book.
Do not change  anything, except the url and the md5 checksum. -->
<sect1 id="package">
        <para>Download: <ulink url="http://your/package-manager/url"/></para>
        <para>MD5 sum: <literal>package-md5-checksum</literal></para>
</sect1>

<!-- If needed, uncomment and edit this:
<sect1 id="patches">
        <para>Download: <ulink url="somepatch-url"/></para>
        <para>MD5 sum: <literal>somepatch-md5</literal></para>
</sect1>
-->

<!-- Do not change the next line. The name of the scriptlet will be taken
from the dbhtml instruction: it is the name of the file less .html, with
xxx-x-added before (x, digits). Furthermore, the tarball name must be in the form
name_x.y.z(.extension) or name-x.y.z(.extension) if the dbhtml
instruction  contains file="name.html" -->
<sect1 id="ch-tools-pkgmngt" role="wrap">
  <?dbhtml filename="dpkg.html"?>
<!-- next line mandatory without change, but feel free to add any title,
other sect2 (with different role), sectinfo and so on -->
  <sect2 role="installation">
<!-- You can use any number of remap="pre", "configure", "make", "test", "install"
<screen><userinput remap="something">Instructions</userinput></screen>.
They are executed in that order. "pre" can be used for patching for example.
In case testing is enabled, the instructions flagged test are logged to a different
file (test-log). If testing is not enabled, they are not executed at all. Do not
put line breaks before and after your instructions. <userinput> without
remap attribute are considered configuration instructions and executed last. You
can also use remap="adjust" for the same purpose. -->
<screen><userinput remap="configure">./configure --prefix=/tools \
    --disable-nls --without-dselect \
    --without-start-stop-daemon \
    --without-update-alternatives \
    --without-install-info \
    --without-zlib --with-bz2=static --without-selinux</userinput></screen>

<screen><userinput remap="make">(cd lib  &amp;&amp; make)
(cd src &amp;&amp; make)
(cd dpkg-deb &amp;&amp; make)
(cd dpkg-split &amp;&amp; make)</userinput></screen>

<screen><userinput remap="install">cp src/dpkg src/dpkg-* /tools/bin
cp dpkg-deb/dpkg-deb /tools/bin
cp dpkg-split/dpkg-split /tools/bin
mkdir -pv /tools/etc/dpkg/{,dpkg.cfg.d}
cp debian/dpkg.cfg /tools/etc/dpkg</userinput></screen>

<screen><userinput>cat &gt;&gt; /tools/etc/dpkg/dpkg.cfg &lt;&lt; EOF
# admindir on LFS system
admindir /var/lib/dpkg
EOF</userinput></screen>

<screen><userinput>cat &gt;&gt; /tools/etc/dpkg/dpkg.cfg &lt;&lt; EOF
# disable fatal error on path checking
force-bad-path
EOF</userinput></screen>

  </sect2>

</sect1>

<!-- Mandatory section for creating dirs. These instructions are added at the
end of the creating dirs instructions of the book. Do not change the
following line -->
<sect1 id="ch-pkgmngt-creatingdirs">

<!-- Put the create dir intructions there. feel free to add
any explaining <title>Title</title> and <para>explanations</para> -->
<screen><userinput>mkdir -pv /var/{log,lib/dpkg/{info,updates}}
mkdir -pv /var/lib/packages</userinput></screen>

</sect1>
<!-- Same for files. Do not change the following line -->
<sect1 id="ch-pkgmngt-createfiles">

<screen><userinput>touch /var/lib/dpkg/{available,status}
touch /var/log/dpkg.log</userinput></screen>

</sect1>

<!-- Last but not least : Final instructions for installing the
package manager at the end of chapter 6. Again, the scriptlet file name is
taken from the dbhtml instruction, with digits added before and .html cut
and the tarball name is formed from this name + version. So the file
here _must_ be the same as in chapter 5. If rendering in html, both
sets of instructions end up in the same file, which is usually not a problem.
-->
<sect1 id="ch-system-pkgmngt" role="wrap">
  <?dbhtml filename="dpkg.html"?>

  <sect2 role="installation">

<screen><userinput remap="configure">./configure --prefix=/usr \
    --without-dselect \
    --without-start-stop-daemon \
    --without-update-alternatives \
    --without-install-info \
    --without-selinux</userinput></screen>

<screen><userinput remap="make">make</userinput></screen>

<!-- Those instructions are executed with PKG_DEST set. They are not processed
in any way to add $PKG_DEST at some place, and the PKG_DEST directory is not
populated before, so it is basically empty. You have thus to create any directory
needed in $PKG_DEST and not otherwise created by the make install command. -->
<screen><userinput remap="install">mkdir -pv $PKG_DEST
make DESTDIR=$PKG_DEST install
mkdir -pv $PKG_DEST/etc/dpkg/{,dpkg.cfg.d}
cp debian/dpkg.cfg $PKG_DEST/etc/dpkg</userinput></screen>

<screen><userinput remap="install">cat &gt;&gt; $PKG_DEST/etc/dpkg/dpkg.cfg &lt;&lt; EOF
# admindir on LFS system
admindir /var/lib/dpkg
EOF</userinput></screen>

<screen><userinput>cat &gt;&gt; $PKG_DEST/etc/dpkg/dpkg.cfg &lt;&lt; EOF
# disable fatal error on path checking
force-bad-path
EOF</userinput></screen>

  </sect2>

</sect1>
</article>
